#pragma once

#include <flash/part.h>
#include <net/net.h>

#define GB_SYSCFG_VER       5

#define FLASH_CMD_SIZE       KB(1)
#define FLASH_CONF_SIZE    KB(16)
#define FLASH_CONF_ADDR    (KB(512) - FLASH_CONF_SIZE) // fixme


#define SC_RESET_MBR        (1 << 0)
#define SC_RESET_NET        (1 << 1)
#define SC_RESET_KERNEL     (1 << 2)
#define SC_RESET_ALL        (~0)


#define CON_DEV_NAME_LEN    63


#define BM_MASK        ((1 << 8) - 1)

#define BM_RAMDISK     (1 << 8)
#define BM_FLASHDISK   (2 << 8)
#define BM_NFS         (4 << 8)


struct LinuxParam
{
	UINT32 dwBootMode;

	int    nRootDev;

	char   szImgKernel[MAX_FILE_NAME_LEN];
	char   szImgRd[MAX_FILE_NAME_LEN];

	char   szNfsSvr[IPV4_STR_LEN];
	char   szNfsPath[NFS_PATH_LEN];

	char   szConDev[CON_DEV_NAME_LEN + 1];
};


struct SysConf
{
	UINT32 dwCheckSum;

	struct PartInfo    mPartInfo; // fixme: to be removed
	struct NetConf     mNetConf;
	struct LinuxParam  mLinuxParam;
};


int GuSysConfLoad(struct SysConf **ppSysConf); // fxime: to be removed

int GuSysConfStore(void);

int GuSysConfGetRoot(void); // fixme: to be removed

int GuSysGetPartInfo(struct PartInfo **ppPartInfo);

int GuSysGetNetConf(struct NetConf **ppNetConf);

int GuSysGetLinuxParam(struct LinuxParam **ppLinuxParam);

